<template>
  <div id="app">
    <div id="nav">
      <a href="https://www.baidu.com">百度</a> |
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link> |
      <router-link to="/case">案例库</router-link> |
      <router-link to="/params/2020/动态路由">动态路由</router-link> |
      <router-link :to="{ name: 'Parameter', params: { newsId:2020,newsTitle:'dsdfsfs' } }">动态参数</router-link>
    </div>
    <p>{{ $route.name }}</p>
    <transition name='fade' mode="out-in">
      <router-view />
    </transition>
    <p>这是路由视图之后的内容</p>
  </div>
</template>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
.fade-enter {
  opacity: 0;
}
.fade-leave {
  opacity: 1;
}
.fade-enter-active {
  transition: opacity 2s;
}
.fade-leave-active {
  transition: opacity 2s;
}
</style>
